//
//  StudentModel.m
//  数据的增删改查
//
//  Created by Clement_Gu on 16/3/15.
//  Copyright © 2016年 小白. All rights reserved.
//

#import "StudentModel.h"

@implementation StudentModel
#define kStuId @"StuId"
#define kStuName @"StuName"
#define kStuAge @"StuAge"
-(instancetype)initWithId:(NSString *)tmpStuID andName:(NSString *)tmpStuName andAge:(NSString *)tmpStuAge
{
    self = [super init];
    if (self) {
        self.stuID = tmpStuID;
        self.stuName = tmpStuName;
        self.stuAge = tmpStuAge;
    }
    return self;
}
//归档解档 这是NScoding 代理的实现
-(void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.stuID forKey:kStuId];
    [aCoder encodeObject:self.stuName forKey:kStuName];
    [aCoder encodeObject:self.stuAge forKey:kStuAge];
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    
    if (self) {
        self.stuID = [aDecoder decodeObjectForKey:kStuId];
        self.stuName = [aDecoder decodeObjectForKey:kStuName];
        self.stuAge = [aDecoder decodeObjectForKey:kStuAge];
    }
    return self;
}
@end
